/*
 * Copyright (c) 2013 WDCY Information Technology Co. Ltd
 * www.wdcy.cc
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * WDCY Information Technology Co. Ltd ("Confidential Information").
 * You shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement you
 * entered into with WDCY Information Technology Co. Ltd.
 */
package com.andaily.zhishifenzi.domain.dto.album;

import com.andaily.zhishifenzi.domain.commons.Photo;
import com.andaily.zhishifenzi.domain.dto.AbstractDto;
import com.andaily.zhishifenzi.domain.dto.file.GeckoFileDto;

import java.util.ArrayList;
import java.util.List;

/**
 * 14-3-22 下午3:26
 *
 * @author Shengzhao Li
 */
public class PhotoDto extends GeckoFileDto {

    //图片完整的URL,如: http://sss.sdd/sdo.jpg
    private String url;

    private String description;
    //是否为 首页显示的图片
    private boolean headPhoto;

    public PhotoDto() {
    }

    public PhotoDto(Photo photo) {
        this(photo, false);
    }

    public PhotoDto(Photo photo, boolean includeData) {
        super(photo, includeData);
        this.url = photo.url();
        this.description = photo.description();
        this.headPhoto = photo.headPhoto();
    }


    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public boolean isHeadPhoto() {
        return headPhoto;
    }

    public void setHeadPhoto(boolean headPhoto) {
        this.headPhoto = headPhoto;
    }

    public static List<PhotoDto> toDtos(List<Photo> photos) {
        List<PhotoDto> dtos = new ArrayList<>(photos.size());
        for (Photo photo : photos) {
            dtos.add(new PhotoDto(photo));
        }
        return dtos;
    }
}
